<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/icon.css"/>">
<script type="text/javascript" src="<c:url value="/js/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-3.1.1.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/easyui-lang-zh_CN.js"/>"></script>
<title>出院办理</title>
<style type="text/css">
.cc_item {
	padding: 10px;
}
</style>
</head>
<body>
<script>
		var cc_outhospitals = [[
	             		{field:'outId',width:'6%',checkbox:true,title:'申请编号'},
	             		{field:'pname', width:'22%',title:'申请的病人'},
	             		{field:'outhodate',width:'20%',title:'申请时间'},
	   	            	{field:'staffName', width:'19%',title:'处理者'},
	             		{field:'handledate',width:'20%',title:'处理时间'},
	            		 {field:'handleremarks', width:'16%',title:'申请状态'}
	                 ]];
		
		function cc_rowStlye(index,row){
			//alert(new Date());
			var date = new Date();
		    var seperator1 = "/";
		    var month = date.getMonth() + 1;
		    var strDate = date.getDate();
		    if (month >= 1 && month <= 9) {
		        month = "0" + month;
		    }
		    if (strDate >= 0 && strDate <= 9) {
		        strDate = "0" + strDate;
		    }
		    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
		    if (row.outhodate==currentdate){
				return 'background-color:#CCFF99;color:red;';
				
			}
		}

</script>
<script type="text/javascript">
	$(function(){
		
		//cc_toqueryByAllOuthosp
		$("#cc_outhospital_reload").linkbutton({
			onClick:function(){
				$("#cc_show_outhospital_pg").propertygrid({
					url:'cc_toqueryByAllOuthosp',
					groupField:'handleremarks'
				});
			}
		});
		$("#cc_outhospital_help").linkbutton({
			onClick:function(){
				var rows=$("#cc_show_outhospital_pg").propertygrid("getSelections");
				if(rows.length==1){
					if(rows[0].handleremarks=="未处理"){
						$.getJSON("cc_toqueryByOuthosp", {"outid" : rows[0].outId}, function(data) {
							$("#cc_show_outhospital_form").form("load", data);
							$("#out_pname").textbox("setValue",rows[0].pname);
							$("#cc_out_id").val(rows[0].outId);
							$("#cc_show_outhospital_win").window('open');
						});
					}else{
						$.messager.alert("提示", "该申请已经处理！");
					}
					
				}else{
					$.messager.alert("提示", "只能选择一行数据，您目前选择了"+rows.length+"行！");
				}
				
				//cc_show_outhospital_form
			}
		});
		var  shenpi_staffId = $("#tontyiStaffId").html();

		var outDoctorid=shenpi_staffId;
		$("#cc_outhospital_update").linkbutton({
			onClick:function(){
				var cc_out_id=$("#cc_out_id").val();
				$('<form>').form('submit', {
				    url:'tocc_updateoutHosp',
				    onSubmit: function(param){
				    	param.outid=cc_out_id;
				    	param.outDoctorid=outDoctorid;
				    },
				    success:function(data){
				    	var json = eval("(" + data + ")");
						$.messager.alert("提示", json.reason);
						$("#cc_show_outhospital_form").form("clear");
						$("#cc_show_outhospital_win").window('close');
						$("#cc_show_outhospital_pg").propertygrid("reload");
				    }
				});
			}
		});
		//调整
		$("#cc_outhospital_tiaozheng").linkbutton({
			onClick:function(){
				$("#cc_show_outhospital_pg").propertygrid({
					groupField:'outhodate'
				});
			}
		});
		//通过
		$("#cc_outhospital_okOne").linkbutton({
			onClick:function(){
				var pmoney= $("#out_ppmoney").textbox("getValue");
				if(pmoney>0){
					//tocc_updateOkoutHosp
					var cc_out_id=$("#cc_out_id").val();
					var cc_out_pid=$("#out_ppatientno").textbox("getValue");
					$('<form>').form('submit', {
					    url:'tocc_updateOkoutHosp',
					    onSubmit: function(param){
					    	param.outid=cc_out_id;
					    	param.outDoctorid=outDoctorid;
					    	param.pid=cc_out_pid;
					    },
					    success:function(data){
					    	var json = eval("(" + data + ")");
							$.messager.alert("提示", json.reason);
							$("#cc_show_outhospital_form").form("clear");
							$("#cc_show_outhospital_win").window('close');
							$("#cc_show_outhospital_pg").propertygrid("reload");
					    }
					});
				}else{
					$.messager.alert("提示", "该病人有费用未结清，不能通过审核！");
				}
			}
		});
	});
	       
</script>

<table id="cc_show_outhospital_pg" class="easyui-propertygrid"
		data-options="
							fitColumns:true,
							fit:true,
							showGroup:true,
							striped:true,
							pagination:true,
							url:'cc_toqueryByAllOuthosp',
							singleSelect:false,
							border:false,
							toolbar:'#cc_outhospital_btn',
							pageSize: 13,
							pageList:[13,26,39,52],
							columns:cc_outhospitals,
							groupField:'handleremarks',
							rowStyler: cc_rowStlye
						">
	</table>
	<div id="cc_outhospital_btn">
			<a id="cc_outhospital_help" class="easyui-linkbutton"
			data-options="iconCls:'icon-help',plain:true">查看详情</a>
			<a id="cc_outhospital_tiaozheng" class="easyui-linkbutton"
			data-options="iconCls:'icon-tiaozheng',plain:true">切换分组</a>
			<a id="cc_outhospital_reload" class="easyui-linkbutton"
			data-options="iconCls:'icon-reload',plain:true">刷新</a><input
			id="cc_outhospital_search" class="easyui-searchbox"
			data-options="menu:'#cc_outhospitaleee',width:220,prompt:'请输入你要查找的内容'">
	</div>
	<div id="cc_outhospitaleee" style="width: 90px">
		<div date-options="name:'name'">申请人</div>
	</div>
<div id="cc_show_outhospital_win" class="easyui-window"
		style="padding: 0px; line-height: 150%;background: rgb(236,243,255);"
		data-options="
			iconCls:'icon-banliyewu',
		     width: 240,
		     height: 170,
		      modal:true,
		     closed: true,
		     title:'病人费用情况'
			">
			<form id="cc_show_outhospital_form" action="" method="post">
				<div style="display: none;">
					<input id="cc_out_id">
				</div>
				<div class="cc_item">
						<input id="out_ppatientno" name="ppatientno" class="easyui-textbox"
							data-options="label: '病人ID:', labelAlign:'right',readonly:'true',
							width: 200">
				</div>
				<div class="cc_item">
						<input id="out_pname" name="pname" class="easyui-textbox"
							data-options="label: '病人姓名:', labelAlign:'right',readonly:'true',
							width: 200">
				</div>
				<div id="cc_out_ppmoney" class="cc_item">
						<input id="out_ppmoney" name="ppmoney" class="easyui-textbox"
							data-options="label: '病人余额:', labelAlign:'right',readonly:'true',
							width: 200">
				</div>
				<div style="padding: 10px; margin-left:20px">
					<a id="cc_outhospital_okOne" class="easyui-linkbutton"
					data-options="iconCls:'icon-ok',plain:true">通过申请</a>
					<a id="cc_outhospital_update" class="easyui-linkbutton"
					data-options="iconCls:'icon-remove',plain:true">驳回申请</a>
				</div>
			</form>
</div>
</body>
</html>